home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
netprog.zip
/
NETPROG.TAR
/
lock
/
locks5.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-12-17
|
333b
|
22 lines
/*
* Locking routines for System V.
*/
#include <unistd.h>
my_lock(fd)
int fd;
{
lseek(fd, 0L, 0); /* rewind before lockf */
if (lockf(fd, F_LOCK, 0L) == -1) /* 0L -> lock entire file */
err_sys("can't F_LOCK");
}
my_unlock(fd)
int fd;
{
lseek(fd, 0L, 0);
if (lockf(fd, F_ULOCK, 0L) == -1)
err_sys("can't F_ULOCK");
}